package a.info {

public class WhiteBoardInfo {
	public var pages:Array = new Array();//WhiteBoardPageInfo
    public var currPage:int = 0; // 0,1,2,3...

    public function WhiteBoardInfo() {
        pages = new Array();
        createPage();
    }

	// 创建新页面
    public function createPage(idx:Number = NaN):void {
    	if(isNaN(idx)) {
    		idx = pages.length;
    	}
    	
    	if(idx < pages.length) {
    		return;
    	}

    	var pagesNum:int = idx - pages.length + 1;

    	for(var i:int = idx; i < pagesNum; i++) {
    		var pageInfo:WhiteBoardPageInfo = new WhiteBoardPageInfo();
    		pageInfo.pageNum = i;
    		pages.push(pageInfo);
    	}

    	currPage = pages.length - 1; 	
    }

    public function getCurrPage():WhiteBoardPageInfo {
        return pages[currPage] as WhiteBoardPageInfo;
    }

    public function getPage(pageNum:int):WhiteBoardPageInfo {
        return pages[pageNum] as WhiteBoardPageInfo;
    }
    
    public function removePage(idx:Number = NaN):void {
    }
    
    public function gotoPage(idx:Number = NaN):void {
    	if(isNaN(idx)) {
    		// @temp tonyy
    	}
    	
    	currPage = idx;
    }
    
    public function clearPage(idx:Number = NaN):void {
    }
    
    public function generateID():String {    	
    	return getCurrPage().generateID();
    }
}
}